﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using ORM.Common.DataAnnotations;
using ORM.Resources;

namespace ORM.Business.Models.Entities
{
    public class Model
    {
        #region Primitive properties

        public int Id { get; set; }

        [RequiredExtended]
        [StringLengthExtended(100, MinimumLength = 1)]
        [Display(Name = "Model_Name", ResourceType = typeof(Labels))]
        public string Name { get; set; }
        [Display(Name = "Model_Description", ResourceType = typeof(Labels))]
        [StringLengthExtended(int.MaxValue / 2)] // Don't remove this line otherwise EF will throw a validation exception
        public string Description { get; set; }
        public bool IsDeleted { get; set; }
        public string Image { get; set; }
        [StringLengthExtended(1000)]
        [Display(Name = "Model_Image", ResourceType = typeof(Labels))]
        public string ImageUrl { get; set; }
        //[Column("ByManufacturer")]
        [Display(Name = "Manufacturer", ResourceType = typeof(Labels))]
        public int ManufacturerId { get; set; }

        //[Column("ByDevice")]
        [Display(Name = "Device", ResourceType = typeof(Labels))]
        public int DeviceId { get; set; }

        #endregion

        #region Navigation properties

        [ForeignKey("ManufacturerId")]
        public virtual Manufacturer Manufacturer { get; set; }

        [ForeignKey("DeviceId")]
        public virtual Device Device { get; set; }

        #endregion
    }
}